﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DLUProject.Domain;
using DLUProject.Services;
using ColorLife.Core.Helper;
public partial class TaiKhoan_Account_ChangePassword : BaseUserControl
{
    public IServices<Account> _service { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSave_ServerClick(object sender, EventArgs e)
    {
        var account = Session.GetAccountLogged();
        if (account == null)
            Response.Redirect("Default.aspx");
        account.Password = PasswordNew.Text.EncodePassword();

        if (_service.Update(account) > 0)
        {
            StatusBox.InnerHtml = "Đổi mật khẩu thành công.";

            StatusBox.Attributes.Add("class", "alert alert-info");
        }
        else
        {
            StatusBox.InnerHtml = "Đổi mật khẩu thất bại.";

            StatusBox.Attributes.Add("class", "alert alert-danger");
        }

        
    }
}